License

Overview

The Cobertura ant tasks are licensed under the Apache Software License, Version 1.1. The rest of Cobertura is licensed under the GNU General Public License, Version 2.0. See below for detailed explanations.

The jcoverage License

There are two separate version of jcoverage. One is released under the GPL (mostly), and the other is released under a custom, commercial license. You may be asking how GPL'd code could also be released under a more restrictive license. This is possible because the owners of the jcoverage copyright chose to dual-license it. From the GNU GPL FAQ:

The GNU GPL does not give users permission to attach other licenses to the program. But the copyright holder for a program can release it under several different licenses in parallel. One of them may be the GNU GPL.

The license that comes in your copy, assuming it was put in by the copyright holder and that you got the copy legitimately, is the license that applies to your copy

Cobertura is a fork of the GPL version of jcoverage. Due to the copyleft nature of the GPL, Cobertura is required to use the same license as jcoverage.

The Apache Software License, Version 1.1

The use of the Apache Software License in Cobertura is very straight forward. Cobertura includes a set of ant tasks which can be used to call Cobertura. Ant itself is licensed under the Apache Software License, Version 2.0. Because ant tasks are loaded directly into the runtime of ant, and the GPL is incompatable with all versions of the Apache Software License, ant tasks can not be licensed under the GPL.

For this reason, the Cobertura ant tasks are licensed under the Apache Software License, Version 1.1. And because these ant tasks are not GPL-compatable, but the rest of Cobertura is GPL, when these ant tasks invoke Cobertura they must do so by exec'ing a new JVM.

The GNU General Public License, Version 2.0

The rest of Cobertura is licensed under the GPL.

Instrumented Java Bytecode

Here's the tricky part. Cobertura modifies your Java bytecode slightly. Below we discuss any possible license implications of these modifications

First off, let me paste an excerpt from GNU's GPL FAQ. It's just something to keep in mind for this section.

Does the GPL require that source code of modified versions be posted to the public?

The GPL does not require you to release your modified version. You are free to make modifications and use them privately, without ever releasing them. This applies to organizations (including companies), too; an organization can make a modified version and use it internally without ever releasing it outside the organization.

For each line of your source code, Cobertura inserts three statements into the bytecode of your program. It does this using a library called ASM. This is called "instrumentation," and is done in the method visitLineNumber() in the class net.sourceforge.cobertura.coverage.MethodInstrumenter. It inserts Java bytecode that does the following:

  1. Gets an instance of coverage data
  2. Finds the coverage data for this class
  3. Increments a hit counter for this line of code

What is the license of this generated code? Good question. Here's another excerpt from the GNU GPL FAQ:

Is there some way that I can GPL the output people get from use of my program? For example, if my program is used to develop hardware designs, can I require that these designs must be free?

In general this is legally impossible; copyright law does not give you any say in the use of the output people make from their data using your program. If the user uses your program to enter or convert his own data, the copyright on the output belongs to him, not you. More generally, when a program translates its input into some other form, the copyright status of the output inherits that of the input it was generated from.

So the only way you have a say in the use of the output is if substantial parts of the output are copied (more or less) from text in your program. For instance, part of the output of Bison (see above) would be covered by the GNU GPL, if we had not made an exception in this specific case.

You could artificially make a program copy certain text into its output even if there is no technical reason to do so. But if that copied text serves no practical purpose, the user could simply delete that text from the output and use only the rest. Then he would not have to obey the conditions on redistribution of the copied text.

In what cases is the output of a GPL program covered by the GPL too?

Only when the program copies part of itself into the output.

What can we conclude from this? That it all depends on how you interpret the license, and that it would probably take a court's decision to really know where you stand. My personal opinion is that the license of the three statements inserted into your bytecode is determined by you, and by default the three statements inherit the license of your program.

References